FROM ubuntu
MAINTAINER fengzhihao 1209103220@qq.com

RUN apt-get update

RUN apt-get install wget -y

RUN apt-get install openjdk-8-jdk -y

RUN apt-get install zip -y

RUN mkdir /usr/kafka-manager

RUN mkdir /usr/kafka-manager/build

WORKDIR /usr/kafka-manager/build

RUN wget https://github.com/yahoo/kafka-manager/archive/2.0.0.2.tar.gz

RUN tar -xvzf 2.0.0.2.tar.gz

WORKDIR /usr/kafka-manager/build/kafka-manager-2.0.0.2

RUN mkdir /root/.sbt/

RUN echo "[repositories]" >> /root/.sbt/repositories

RUN echo "public: http://maven.aliyun.com/nexus/content/groups/public/" >> /root/.sbt/repositories

RUN echo "typesafe:http://dl.bintray.com/typesafe/ivy-releases/ , [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly" >> /root/.sbt/repositories

RUN echo "ivy-sbt-plugin:http://dl.bintray.com/sbt/sbt-plugin-releases/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]">> /root/.sbt/repositories

RUN echo "sonatype-oss-releases" >> /root/.sbt/repositories

RUN echo "sonatype-oss-snapshots" >> /root/.sbt/repositories

RUN cat /root/.sbt/repositories

RUN ./sbt clean dist
       
RUN mv /usr/kafka-manager/build/kafka-manager-2.0.0.2/target/universal/kafka-manager-2.0.0.2.zip /tmp/

WORKDIR /usr/kafka-manager/

RUN rm -rf /usr/kafka-manager/*

RUN mv /tmp/kafka-manager-2.0.0.2.zip /usr/kafka-manager/

RUN unzip kafka-manager-2.0.0.2.zip

RUN mv kafka-manager-2.0.0.2/* ./

RUN rm -rf kafka-manager-2.0.0.2.zip

CMD ["/usr/kafka-manager/bin/kafka-manager", "-Dconfig.file=/usr/kafka-manager/conf/application.conf"]



